import React, { useEffect, useState } from 'react'

export default function App() {
  let [opacity , setOpacity] = useState(1);
  useEffect(() => {
   const changeUnm = setInterval(() => {
      opacity -= 0.1;
      if(opacity <= 0){
        opacity = 1
      }
      setOpacity(opacity)
    },200);
    return () => {
      clearInterval(changeUnm)
    }
  },[])
  return (
    <div>
       <h1 style={{opacity}}>你看我在变化</h1>
    </div>
  )
}
